package pages;

/**
 * Created by Esferat on 02.08.2014.
 */

import model.TestBase;
import org.openqa.selenium.By;
import static org.testng.Assert.assertEquals;

public class LandingPage extends TestBase {


    public boolean isLandingPage() {
        return uh.textIsPresent(By.xpath("//*[@class='home']"), "Домашняя страница");
    }

    public boolean isLogin() {
        return uh.textIsPresent(By.xpath("//*[@class='my-account']"), "Моя учетная запись");
    }

    public boolean isLogout() {
        return uh.textIsPresent(By.xpath("//*[@class='flash error']"), "Неправильное имя пользователя или пароль");
    }

    public void gotoProjects() {
        uh.click(By.xpath("//*[@class='projects']"));
    }

    public void gotoMyProjects() { uh.click(By.xpath("//*[contains(text(),'akopylov')]")); }

    public void IssueCreating() {
        uh.click(By.xpath("//*[@class='new-issue']"));
        uh.sendKeystoField(By.xpath("//input[@id='issue_subject']"));
        uh.sendKeystoField(By.xpath("//*[@id='issue_description']"));
        uh.click(By.xpath("//input[@name='commit']"));
    }

    public boolean isCraeted() { return uh.textIsPresent(By.xpath("//div[@class='flash notice']"),"создана"); }

    public void TaskEditor() {
        uh.click(By.xpath("//*[@class='issues']"));
        uh.click(By.xpath("//*[contains(text(),'new task')]"));
        uh.click(By.xpath("//a[@class='icon icon-edit']"));
        uh.click(By.xpath("//*[contains(text(),'Больше')]"));
        uh.clearField(By.xpath("//input[@id='issue_subject']"));
        uh.sendKeystoField2(By.xpath("//input[@id='issue_subject']"));
        uh.clearField(By.xpath("//*[@id='issue_description']"));
        uh.sendKeystoField2(By.xpath("//*[@id='issue_description']"));
        uh.click(By.xpath("//*[@value='Принять']"));
    }

    public boolean isEdited() { return uh.textIsPresent(By.xpath("//div[@class='flash notice']"),"успешно"); }




}
